package com.chhlz.module.base.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@Table(name="bill_dish")
@DynamicUpdate(true)
@DynamicInsert(true)
public class BillDish implements java.io.Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -4372256266942516794L;
	private int billId;
	private int dishId;
	private int unitId;
	private int amount;
	private String description;
	
	@Id
	@Column(name="bill_id")
	public int getBillId() {
		return billId;
	}
	public void setBillId(int billId) {
		this.billId = billId;
	}
	
	@Column(name="dish_id")
	public int getDishId() {
		return dishId;
	}
	public void setDishId(int dishId) {
		this.dishId = dishId;
	}
	@Column(name="unit_id")
	public int getUnitId() {
		return unitId;
	}
	public void setUnitId(int unitId) {
		this.unitId = unitId;
	}
	@Column(name="amount")
	public int getAmount() {
		return amount;
	}
	public void setAmount(int amount) {
		this.amount = amount;
	}
	@Column(name="description")
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + amount;
		result = prime * result + billId;
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + dishId;
		result = prime * result + unitId;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BillDish other = (BillDish) obj;
		if (amount != other.amount)
			return false;
		if (billId != other.billId)
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (dishId != other.dishId)
			return false;
		if (unitId != other.unitId)
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "BillDish [billId=" + billId + ", dishId=" + dishId
				+ ", unitId=" + unitId + ", amount=" + amount
				+ ", description=" + description + "]";
	}

}
